package com.hxy.provider;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class Sender {
    @Autowired
    private AmqpTemplate template;

    @Value("${mq.config.exchange}")
    private String exchange;

    @Value("${mq.config.queue.info.routing.key}")
    private String infoRoutingKey;

    @Value("${mq.config.queue.error.routing.key}")
    private String errorRoutingKey;

    public void sendInfo(String msg){
        template.convertAndSend(exchange,infoRoutingKey,msg);
    }

    public void sendError(String msg){
        template.convertAndSend(exchange,errorRoutingKey,msg);
    }
}
